<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title>推送通知</title>
    <t:base type="jquery,easyui,tools,DatePicker"></t:base>
</head>
<style type="text/css">

</style>

<script type="text/javascript">




    $(function(){

        $("#pushType").change(function(){

            if($(this).val() == 0){
                $(".consumerClass").hide();

            }else{
                $(".consumerClass").show();

            }

        });

        $("#objectType option").each(function(){
            if($(this).val() == 101){
                $(this).remove();

            }
        });


    })

    function f_beforeSubmit(){

        if($("#pushType").val() == 1 && $("#userIds").val() == ""){

            tip("请选择阅读用户！");

            return false;

        }

    }


    function f_test(id,nickName){


    }


</script>
<body  scroll="no" >
<t:formvalid  formid="addformobj" dialog="true" beforeSubmit="f_beforeSubmit()" usePlugin="password" layout="table" action="pushRecordsController.do?save" >
   <input id="id" name="id" type="hidden" value="${pushRecords.id}">

    <table  cellpadding="0" cellspacing="1" class="formtable">

        <tr>
            <td align="right" style="width: 100px;">
                <label class="Validform_label">
                    推送标题:
                </label>
            </td>
            <td class="value" style="width: 300px;">
                <input class="inputxt" id="title" value="${pushRecords.title}"  name="title" datatype='*'>
                <span class="Validform_checktip"></span>
            </td>

        </tr>
        <tr>
            <td align="right" >
                <label class="Validform_label">
                    提示文字:
                </label>
            </td>
            <td class="value" >
                <input class="inputxt" id="tag" value="${pushRecords.ticker}"  name="ticker" datatype='*'>
                <span class="Validform_checktip"></span>
            </td>


        </tr>

        <tr>
            <td align="right">
                <label class="Validform_label">
                    推送类型:
                </label>
            </td>
            <td class="value">
                <t:dictSelect field="objectType"  type="select" typeGroupCode="pushStyle" defaultVal="${pushRecords.objectType == null ? 102:pushRecords.objectType}"
                              hasLabel="false" extendJson="{datatype='*',onchange='f_objectType()'}" id="objectType" >
                </t:dictSelect>
                <span class="Validform_checktip"></span>
            </td>
        </tr>

        <tr class="articleClass">
            <td align="right" >
                <label class="Validform_label" >
                    百科文章:
                </label>
            </td>
            <td class="value" colspan="3">
                <input name="objectId" type="hidden" value="" id="objectIdBK" >
                <input name="articleTitleBK" class="inputxt" value="" id="articleTitleBK" datatype="*" readonly="readonly"  />
                <t:choose  hiddenName="objectIdBK" hiddenid="id" url="pushRecordsController.do?miniArticle" name="tdIscenterList"
                           icon="icon-search" title="百科文章列表" inputTextname="articleTitleBK" textname="title" isclear="true" isSuperposition="false"
                           height="450px" width="500px"></t:choose>
                <span class="Validform_checktip">请选择百科文章</span>
            </td>
        </tr>
        <tr class="officialWhClass">
            <td align="right" >
                <label class="Validform_label" >
                    新闻文章:
                </label>
            </td>
            <td class="value" colspan="3">
                <input name="objectId" type="hidden" value="" id="objectIdXW" >
                <input name="articleTitleXW" class="inputxt" value="" id="articleTitleXW" datatype="*" readonly="readonly"  />
                <t:choose  hiddenName="objectIdXW" hiddenid="articleId" url="pushRecordsController.do?miniOfficialWhList" name="officialWhList"
                           icon="icon-search" title="新闻文章列表" inputTextname="articleTitleXW" textname="title" isclear="true" isSuperposition="false"
                           height="450px" width="500px"></t:choose>
                <span class="Validform_checktip">请选择新闻文章</span>
            </td>
        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label">
                    推送方式:
                </label>
            </td>
            <td class="value">
                <select datatype="*" name="pushType" id="pushType">
                    <option value="0">所有人</option>
                    <option value="1">部分用户</option>

                </select>
                <span class="Validform_checktip"></span>
            </td>
        </tr>

        <tr class="consumerClass" style="display: none;">
            <td align="right" >
                <label class="Validform_label">
                    客户端用户:
                </label>
            </td>
            <td class="value" colspan="3">
                <input name="receiverIds" type="hidden" value="" id="userIds" >
                <input name="receiver" class="inputxt" value="" id="userNames"  readonly="readonly"  />
                <t:choose  hiddenName="userIds" hiddenid="customerId" url="pushRecordsController.do?miniUserList" name="userList"
                           icon="icon-search" title="客户端列表" inputTextname="userNames" textname="nickname" isclear="true" isSuperposition="true"
                        height="450px" width="500px"></t:choose>
                <span class="Validform_checktip">请选择客户端用户</span>
            </td>
        </tr>

        <tr>

            <td align="right">
                <label class="Validform_label">
                    内容:
                </label>
            </td>
            <td class="value" colspan="3">
                <textarea id="content" datatype='*' name="content" rows="5" style="width: 575px;">${pushRecords.content}</textarea>
                <span class="Validform_checktip"></span>
            </td>

        </tr>



    </table>
</t:formvalid>
</body>
<script type="text/javascript">

    $(function(){
        f_objectType();
    })

    function f_objectType(){

        var objectType = $("#objectType").val();

        if(objectType == 102){
            $(".articleClass").show();
            $("#articleTitle").removeAttr("ignore");

            $(".officialWhClass").hide();
            $("#articleTitleXW").attr("ignore","ignore");

            $("#objectIdXW").val("");
        }else if(objectType == 103) {
            $(".articleClass").hide();
            $("#articleTitleBK").attr("ignore","ignore");

            $(".officialWhClass").show();
            $("#articleTitleXW").removeAttr("ignore");
            $("#objectIdBK").val("");

        }else{
            $(".articleClass").hide();
            $("#articleTitle").attr("ignore","ignore");

            $(".officialWhClass").hide();
            $("#articleTitleXW").attr("ignore","ignore");

        }

    }


</script>
</html>